import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/index.vue'
import MenuPage from '../views/MenuPage.vue'
import EditKnowledge from '../views/knowledge/EditKnowledge.vue'

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login/index.vue')
  },
  {
    path: '/',
    component: Layout,
    redirect: '/user',
    children: [
      {
        path: 'system',
        name: 'System',
        redirect: '/user',
        meta: { title: '系统管理', icon: 'Setting' },
        children: [
          {
            path: '/user',
            name: 'User',
            component: () => import('../views/user/index.vue'),
            meta: { title: '用户管理', icon: 'User' }
          },
          {
            path: '/model',
            name: 'Model',
            component: () => import('../views/model/index.vue'),
            meta: { title: '模型管理', icon: 'Monitor' }
          }
        ]
      },
      {
        path: '/operation',
        name: 'operation',
        redirect: '/operation/vector',
        meta: { title: '运营管理', icon: 'Operation' },
        children: [
          {
            path: '/vector',
            name: 'Vector',
            component: () => import('../views/vector/index.vue'),
            meta: { title: '向量库管理', icon: 'DataLine' }
          },
          {
            path: '/knowledge',
            name: 'Knowledge',
            component: () => import('../views/knowledge/index.vue'),
            meta: { title: '知识库管理', icon: 'Files' }
          },
          {
            path: '/chat',
            name: 'Chat',
            component: () => import('../views/chat/index.vue'),
            meta: { title: '聊天管理', icon: 'ChatDotRound' }
          },
          {
            path: '/goChat',
            name: 'goChat',
            component: () => import('../views/chat/ChatView.vue'),
            meta: { title: '去聊天', icon: 'ChatDotRound' }
          }
        ]
      }
    ]
  },
  {
    path: '/menu/:id',
    name: 'MenuPage',
    component: MenuPage,
    props: true
  },
  {
    path: '/edit-knowledge/:id',
    name: 'EditKnowledge',
    component: EditKnowledge,
    props: true
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router
